package org.gosilver.beans.factory.support;

import org.gosilver.beans.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * 单例注册接口实现
 */
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {
    private Map<String, Object> singletonObjectsMap = new HashMap<>();
    @Override
    public Object getSingleton(String beanName) {
        return singletonObjectsMap.get(beanName);
    }

    protected void addSingleton(String beanName, Object singleton) {
        singletonObjectsMap.put(beanName, singleton);
    }
}
